# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Author:张广勤
@Web site: https://www.tunan.wang
@Github:www.github.com
 
@File:mybro04.py
@Time:2022/3/1 10:15

@Motto:不积跬步无以至千里，不积小流无以成江海！
"""
from mybro03 import Mybro

bro=Mybro()
bro.switchquery()
zd="企业一套表统计调查制度(2021)"
zqlist=bro.getyjnopts(zd)
print(zqlist)
with open('mulu.csv','w',encoding='u8') as f:
    #f.write(zd)
    f.write('')

for zq in zqlist:
    bblist,bbhb=bro.getbblist1(zd,zq)
    #print(bblist)
    print(bbhb)
    for bb in bbhb:
        bb,cxml=bro.getquery1(bb)
        print(f'制度：{zd},周期：{zq},报表：{bb},查询目录：{cxml}')
        with open('mulu.csv','a',encoding='u8') as f:
            f.write(f'{zd},{zq},{bb[0]},{cxml}')
            f.write('\n')
bro.closewindow()